package com.mall.promo.dto;

import com.mall.commons.result.AbstractRequest;
import com.mall.commons.tool.exception.ValidateException;
import com.mall.promo.constants.PromoRetCode;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author
 * @date 2020/12/26 21:56
 */
@Data
public class SecKillUserInfo extends AbstractRequest {

    /**
     * tel : 18782059038
     * userName : admin
     * streetName : 上海青浦区汇联路
     * addressId : 5
     * psId : 9
     * productId : 100057401
     */

    private String tel;
    //收货人姓名
    private String userName;
    private String streetName;
    private Integer addressId;
    private Integer psId;
    private Integer productId;

    @Override
    public void requestCheck() {
        if (StringUtils.isEmpty(tel)
                || StringUtils.isEmpty(userName)
                || StringUtils.isEmpty(streetName)
                || addressId == null
                || psId == null
                || productId == null) {
            throw new ValidateException(PromoRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(),PromoRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
    }
}
